import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Listener;


public class chatwindow {

	protected Shell shell;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			chatwindow window = new chatwindow();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shell = new Shell();
		shell.setSize(450, 520);
		shell.setText("SWT Application");
		
		Label lblCurrentUser = new Label(shell, SWT.NONE);
		lblCurrentUser.setBounds(10, 10, 107, 17);
		lblCurrentUser.setText("Now talking to:");
		
		Label lblMessages = new Label(shell, SWT.NONE);
		lblMessages.setBounds(10, 33, 70, 17);
		lblMessages.setText("Messages");
		
		Text messages = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
		messages.setBounds(10, 56, 428, 277);
		
		Label lblInputBox = new Label(shell, SWT.NONE);
		lblInputBox.setBounds(10, 350, 199, 17);
		lblInputBox.setText("Input Box");
		
		Text entering = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
		entering.setBounds(10, 373, 428, 72);
		
		Label lblUserNamePlace = new Label(shell, SWT.NONE);
		lblUserNamePlace.setBounds(118, 10, 320, 17);
		lblUserNamePlace.setText("User Name Place Holder");
		
		Button btnSend = new Button(shell, SWT.NONE);
		btnSend.setBounds(347, 451, 91, 29);
		btnSend.setText("Send");
		btnSend.addListener(SWT.Selection, new Listener() {
			public void handleEvent(org.eclipse.swt.widgets.Event event) {
				// send the message
			}
		});

	}
}
